package springRepo.Library.repository.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

public class DAOJDBCUtil {
	
	private static final Logger LOGGER = Logger.getLogger(DAOJDBCUtil.class.getCanonicalName());
	
	public static void close(Statement statement) {
        if (statement != null) {
            try {
                statement.close();
            } catch (SQLException e) {
            	LOGGER.log(Level.SEVERE, e.getMessage());
            }
        }
    }
	
	public static void close(ResultSet resultSet) {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            	LOGGER.log(Level.SEVERE, e.getMessage());
            }
        }
    }
	
	public static void close(Connection connection) {
        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException e) {
            	LOGGER.log(Level.SEVERE, e.getMessage());
            }
        }
    }
}
